XOR

[Logical Operator] - Returns True or False for a logic comparsion


Syntax:

argument1 XOR argument2

Parameters:

argument1: any argument

argument2: another argument

Description:

Performs a logical XOR (Exclusive OR) and returns TRUE if one of the arguments is true and one of the arguments is false. In essense, returns true if ONLY one of the arguments is true.

Logicals operators are like in ZX Spectrum Basic. Their result can be either False (which is represented with 0) or True, which might be any other value. Don't expect True value number to be always 1. If you need 0/1 values for boolean evaluations, use --strict-boolean compiler option. This might add a little overhead to boolean evaluations, tough.

a XOR b
a
b
Result
False
False
False
False
True
True
True
False
True
True
True
False

Examples:

REM 'Or
LET a = -1
LET b = 17
IF a=-1 XOR b=17 THEN
	PRINT "Both arguments are both false or true, but I can't tell which"
END IF

Notes:

See also:

AND, OR, NOT


Supported Plattforms:

ZX Spectrum